import { Router } from 'express'
import { WorkflowTemplateController } from '../controllers/workflowTemplate'
import { Request, Response, NextFunction } from 'express'

const router = Router()
const controller = new WorkflowTemplateController()

// 添加日志中间件
const logRequest = (req: Request, res: Response, next: NextFunction) => {
    console.log(`${req.method} ${req.path}`, {
        query: req.query,
        body: req.body,
        params: req.params
    })
    next()
}

router.use(logRequest)

router.get('/', controller.getTemplates)
router.post('/', controller.createTemplate)
router.put('/:id', controller.updateTemplate)
router.delete('/:id', controller.deleteTemplate)
router.post('/:id/clone', controller.cloneTemplate)

export default router 